package com.cvo.scrumtoolkit.client;

import com.cvo.scrumtoolkit.client.controller.Controller;
import com.cvo.scrumtoolkit.client.controller.ControllerImpl;
import com.cvo.scrumtoolkit.client.controller.HistoryManager;
import com.cvo.scrumtoolkit.client.controller.View;
import com.cvo.scrumtoolkit.client.pannels.MenuPanel;
import com.cvo.scrumtoolkit.client.pannels.PersistentService;
import com.cvo.scrumtoolkit.client.pannels.PersistentServiceAsync;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Scrumtool implements EntryPoint {
	/**
	 * The message displayed to the user when the server cannot be reached or
	 * returns an error.
	 */
	private static final String SERVER_ERROR = "An error occurred while "
			+ "attempting to contact the server. Please check your network "
			+ "connection and try again.";

	/**
	 * Create a remote service proxy to talk to the server-side Greeting
	 * service.
	 */
	//private final ScrumToolServiceAsync scrumtoolService = GWT.create(ScrumToolService.class);

	/**
	 * This is the entry point method.
	 */

	// private VerticalPanel mainPanel = new VerticalPanel();
	// private FlexTable projectInfoPanel = new FlexTable();

	
	//Test
	
	private final Controller controller = ControllerImpl.getController(RootPanel.get("contentContainer"));
	  private final PersistentServiceAsync persistentService = GWT.create(PersistentService.class);
	
	
	public void onModuleLoad() {
		
		persistentService.register(new AsyncCallback<Void>() {
			
			@Override
			public void onSuccess(Void result) {
				System.out.println("Alles is netjes geregistreerd");
				
			}
			
			@Override
			public void onFailure(Throwable caught) {
				System.out.println("Alles is niet geregistreerd");
				
			}
		});
		
	RootPanel.get().setStyleName("root");
	
		RootPanel.get("menuContainer").add(new MenuPanel());
		//controller.changeView(View.HOME, null, null);
		HistoryManager.gotoUrl("home/0/0");
		


	}

	

}
